package com.mvc.service.healthmanager.impl;

import org.huangqj.consant.ValidatorUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mvc.dao.mapper.PersonIdDao;
import com.mvc.service.healthmanager.PersonIdServiceI;
import com.mvc.utils.StringUtil;




@Service
public class PersonIdServiceImpl implements PersonIdServiceI {
	
	@Autowired
	private PersonIdDao pd;

	@Override
	public String getMaxStr(String userCode) {
		int maxGet = 1;
		String max = pd.getMaxPersonId(userCode);
		if (max!=null) {
			max = max.substring(max.length()-5, max.length());
			maxGet = Integer.parseInt(max) + 1;
		}
		String str = StringUtil.formatString(5, maxGet);
		return userCode+str;
	}

}
